﻿package mortal.game.view.active11
{
    import com.mui.controls.*;
    import com.mui.utils.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.firstReCharge.*;
    import mortal.mvc.core.*;

    public class Active11PanelCard extends GSprite
    {
        protected var _bg:GImageBitmap;
        protected var _totalM:GTextFiled;

        public function Active11PanelCard()
        {
            return;
        }// end function

        protected function onClickBtn(event:MouseEvent) : void
        {
            GameUtil.gotoRecharge(ModuleTypeConst.Active11);
            return;
        }// end function

        protected function onClickBtnCard(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.RechargeAct11DayRc200));
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            var _loc_4:Array = null;
            var _loc_5:Array = null;
            var _loc_6:ItemData = null;
            var _loc_7:int = 0;
            var _loc_8:int = 0;
            var _loc_9:EffectItem = null;
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap(ImagesConst.Active11PanelCard, 0, 0, this);
            this._totalM = UIFactory.gTextField("", 449, 145, 142, 22, this);
            var _loc_1:* = UIFactory.gLoadingButton(ImagesConst.RebateDayRechargeOpenPage2_upSkin, 393, 181, 141, 40, this);
            _loc_1.label = "";
            _loc_1.configEventListener(MouseEvent.CLICK, this.onClickBtn);
            pushUIToDisposeVec(_loc_1);
            var _loc_2:* = UIFactory.gLoadingButton(ResFileConst.Active11GotoCard, 536, 180, 141, 42, this);
            _loc_2.configEventListener(MouseEvent.CLICK, this.onClickBtnCard);
            pushUIToDisposeVec(_loc_2);
            var _loc_3:* = ItemConfig.instance.getConfig(120701000) as ItemGiftBagInfo;
            if (_loc_3)
            {
                _loc_4 = _loc_3.itemList.split("&");
                _loc_7 = _loc_4.length;
                while (_loc_8 < _loc_7)
                {
                    
                    if (_loc_4[_loc_8])
                    {
                        _loc_5 = _loc_4[_loc_8].split("#");
                        _loc_6 = new ItemData(int(_loc_5[1]));
                        if (_loc_6.itemInfo && ItemsUtil.isFitCarrer(_loc_6))
                        {
                            _loc_9 = UICompomentPool.getUICompoment(EffectItem);
                            _loc_9.setItemStyle(ItemStyleConst.Big, ImagesConst.RewardItemBigBg, 4, 4);
                            _loc_9.isShowLock = true;
                            _loc_9.itemData = _loc_6;
                            _loc_9.amount = _loc_5[2];
                            _loc_9.y = 340;
                            _loc_9.x = 135 + 70 * _loc_8;
                            this.addChild(_loc_9);
                            this.pushUIToDisposeVec(_loc_9);
                        }
                    }
                    _loc_8++;
                }
            }
            this.updateTotalM();
            NetDispatcher.addCmdListener(ServerCommand.RebateDayChargeInfoBack, this.updateTotalM);
            return;
        }// end function

        protected function updateTotalM(param1 = null) : void
        {
            this._totalM.text = "" + Language.getString(70816) + Cache.instance.rebate.rechargeSum;
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            NetDispatcher.removeCmdListener(ServerCommand.RebateDayChargeInfoBack, this.updateTotalM);
            this._bg.dispose();
            this._bg = null;
            this._totalM.dispose();
            this._totalM = null;
            super.disposeImpl();
            return;
        }// end function

    }
}
